package com.todod.base.module.base.dal.mysql.protocols;

import java.util.*;

import com.todod.base.framework.common.pojo.PageResult;
import com.todod.base.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.todod.base.framework.mybatis.core.mapper.BaseMapperX;
import com.todod.base.module.base.dal.dataobject.protocols.ProtocolsDO;
import org.apache.ibatis.annotations.Mapper;
import com.todod.base.module.base.controller.admin.protocols.vo.*;

/**
 * 协议标准 Mapper
 *
 * @author 平台
 */
@Mapper
public interface ProtocolsMapper extends BaseMapperX<ProtocolsDO> {

    default PageResult<ProtocolsDO> selectPage(ProtocolsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProtocolsDO>()
                .eqIfPresent(ProtocolsDO::getDeviceType, reqVO.getDeviceType())
                .eqIfPresent(ProtocolsDO::getDeviceMode, reqVO.getDeviceMode())
                .eqIfPresent(ProtocolsDO::getWitsCode, reqVO.getWitsCode())
                .eqIfPresent(ProtocolsDO::getState, reqVO.getState())
                .betweenIfPresent(ProtocolsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProtocolsDO::getId));
    }

}